﻿    <script type="text/javascript">
        var ds = new datasource();
        var f = new childform();
        $(document).ready(function () {
            ds.c = "Way.Contract.MVC.ContractController";
            ds.init();
            var tool = new toolstrip();
            tool.applyTo = 'menu';
            tool.datasource = ds;
            tool.issearch = false;
            tool.init();
            f.title = ds.modeldata.title;
            f.childitem = ds.modeldata.childitem;
            f.parent = ds;
            f.childfooter = ds.ischildfooter;
            f.fit = true;
            f.applyTo = "form";
            f.m = "add";
            f.init();
            $("#layout").layout();
            var data = ds.load();
            f.val(data.rows[0]);
            var grid = f.findgrid(0);
            grid.insertRow(data.tag);
        });
        function saveinfo(data) {
            ds.selectItem = f.val();
            ds.clickcommand(data.command, data); $.messager.show({ title: '消息', msg: '保存完成。', showType: 'show' });
        }
        function uploadDll(data) {
            $.upload({
                // 上传地址
                url: webjs.filepost,
                // 其他表单数据
                params: { d: 'c' },
                // 文件域名字
                fileName: 'filedata',
                // 上传完成后, 返回json, text
                dataType: 'json',
                // 上传之前回调,return true表示可继续上传
                onSend: function () {
                    return true;
                },
                // 上传之后回调
                onComplate: function (file) {
                    if (file) {
                        var name = file[0];
                        if (name) {
                            data.sender.datasource.submit(data.command, "file=" + name, function (e) {
                                if (e && e.error) {
                                    $.messager.alert('异常', e.errormsg, 'error');
                                }
                                else {
                                    var data = ds.load();
                                    var grid = f.findgrid(0);
                                    grid.insertRow(data.tag);
                                    $.messager.show({ title: '消息', msg: '上传完成。', showType: 'show' });
                                }
                            });
                        }
                    }
                }
            });
            return false;
        }
     </script>
<div  border="false" class="easyui-layout" fit="true" id="layout">
<div border="true" region="north" style="height:30px;"><div id="menu"/></div>
<div border="false" region="center"><div id="form"/></div>
</div>
